home *** CD-ROM | disk | FTP | other *** search
- Path: hermes.oc.com!usenet
- From: Larry Weiss <lfw@oc.com>
- Newsgroups: comp.lang.c
- Subject: Re: Learning C.
- Date: Fri, 09 Feb 1996 12:33:30 -0600
- Organization: OpenConnect Systems, Dallas, TX, USA
- Message-ID: <311B937A.46EB@oc.com>
- References: <Pine.SUN.3.90.960209112512.133A-100000@galileo.cris.com>
- NNTP-Posting-Host: ocs2228.oc.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 2.0 (Win16; I)
- CC: lfw@oc.com
-
- Guy Schlosser wrote:
-
- > How do you incorporate DOS commands such as cd\, dir, or format into
- > a C program or is there a more portable way to do these types of tasks?
-
- > How do you generate random numbers in C?
-
- A standard C language function named rand() is available for pseudo-random
- number generation. A companion function srand() exists for seeding the
- process.
-
- A standard C language function named system() is available for requesting
- operating services like format or dir. You'll need the documentation for
- a particular implementation of C to learn the details of how to specify
- the command string. Usually it's straightforward, for example:
-
- system("dir");
-